#ifndef LOGINDIALOG_H
#define LOGINDIALOG_H
#include <QModelIndex>
#include "common/gui/tdialog.h"
#include <QComboBox>
#include <QModelIndex>

namespace Ui {
class LoginDialog;
}

class LoginDialog : public TDialog
{
    Q_OBJECT
    
public:
    explicit LoginDialog(const QModelIndex& index = QModelIndex(),QWidget *parent = 0);
    void initUser(const QModelIndex& index);
    static int permission();
    static void setPermission(int permission);

   static void setLogStatus(bool login);
   static bool LogStatus();

   static QString user();
    static QString technicianString(void);
    ~LoginDialog();
    static bool changeUserByUserCode(const QString &user_code);
    void setUserName(QModelIndex index);
public slots:
    void Login(void);
#ifdef __CRAB_SCALE__
    void onLoginOk();
    void onLoginFail(const QString &str);
#endif
    //void close(void);
    void clear(void);


signals:
    void hasLogin();
    //void changeOperator(QString str);

private:
    virtual void keyPressEvent(QKeyEvent *);
    //void keyPressEvent(QKeyEvent *);
    Ui::LoginDialog *ui;
    static int mPermission;
    static QString mUser;



};

#endif // LOGINDIALOG_H
